#include <iostream>

using namespace std;

// (1 2 X 4 X X 7 8 X X 11 X 13 14 X)

const int NUMS[8] = {1, 2, 4, 7, 8, 11, 13, 14};

int main()
{
    freopen("mb.in", "r", stdin);
    freopen("mb.out", "w", stdout);
    int n, times;
    cin >> n;
    times = n / 8;
    n %= 8;
    cout << times * 15 + NUMS[n - 1] << endl;
    return 0;
}
